package com.perfect.factory;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractNameValueGatewayFilterFactory;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MyGatewayFilterFactory extends AbstractNameValueGatewayFilterFactory {
    @Override
    public GatewayFilter apply(NameValueConfig config) {

        return (exchange,  chain) ->{
            log.info("调用MyGatewayFilterFactory=====name="+config.getName()+"value="+config.getValue());
            return chain.filter(exchange);
        };
    }
}
